package com.kksoft.readcm.a;

import com.kksoft.readcm.activity.App;
import java.security.KeyStore;
import org.apache.http.HttpVersion;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.scheme.SocketFactory;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpProtocolParams;

public final class ag extends AppObservable
{
  final DefaultHttpClient defaultHttpClient;

  public ag()
  {
    BasicHttpParams localBasicHttpParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(localBasicHttpParams, 5000);
    HttpConnectionParams.setSoTimeout(localBasicHttpParams, 15000);
    ConnManagerParams.setMaxTotalConnections(localBasicHttpParams, 60);
    HttpVersion localHttpVersion = HttpVersion.HTTP_1_1;
    HttpProtocolParams.setVersion(localBasicHttpParams, localHttpVersion);
    try
    {
      KeyStore localKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
      localKeyStore.load(null, null);
      ai localai = new ai(this, localKeyStore);
      X509HostnameVerifier localX509HostnameVerifier = SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
      localai.setHostnameVerifier(localX509HostnameVerifier);
      SchemeRegistry localSchemeRegistry = new SchemeRegistry();
      PlainSocketFactory localPlainSocketFactory = PlainSocketFactory.getSocketFactory();
      localSchemeRegistry.register(new Scheme("http", localPlainSocketFactory, 80));
      localSchemeRegistry.register(new Scheme("https", (SocketFactory)localai, 443));
      ThreadSafeClientConnManager localThreadSafeClientConnManager = new ThreadSafeClientConnManager(localBasicHttpParams, localSchemeRegistry);
      DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(localThreadSafeClientConnManager, localBasicHttpParams);
      this.defaultHttpClient = localDefaultHttpClient;
      
    }
    catch (Exception localException)
    {
      while (true)
      {
        SSLSocketFactory localSSLSocketFactory = SSLSocketFactory.getSocketFactory();
        App.showError(localException, 1);
        Object localObject = localSSLSocketFactory;
      }
    }
  }

  public final DefaultHttpClient a()
  {
    return this.defaultHttpClient;
  }

  public final void i()
  {
    super.i();
    this.defaultHttpClient.getConnectionManager().shutdown();
  }
}